package com.vidaappv1;

import java.util.ArrayList;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.util.Log;
import android.widget.RadioButton;

public class DrinksMenu extends Activity {
	private static final String DEBUG_TAG = "output check";

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_drinks_menu);
		
		final ArrayList<RadioButton> rb = new ArrayList<RadioButton>();
		
		RadioButton rb1 = (RadioButton)findViewById(R.id.radioButton1);
		RadioButton rb2 = (RadioButton)findViewById(R.id.radioButton2);
		RadioButton rb3 = (RadioButton)findViewById(R.id.radioButton3);
		RadioButton rb4 = (RadioButton)findViewById(R.id.radioButton4);
		RadioButton rb5 = (RadioButton)findViewById(R.id.radioButton5);
		RadioButton rb6 = (RadioButton)findViewById(R.id.radioButton6);
		RadioButton rb7 = (RadioButton)findViewById(R.id.radioButton7);
		RadioButton rb8 = (RadioButton)findViewById(R.id.radioButton8);
		RadioButton rb9 = (RadioButton)findViewById(R.id.radioButton9);
		RadioButton rb10 = (RadioButton)findViewById(R.id.radioButton10);
		RadioButton rb11 = (RadioButton)findViewById(R.id.radioButton11);
		RadioButton rb12 = (RadioButton)findViewById(R.id.radioButton12);
		RadioButton rb13 = (RadioButton)findViewById(R.id.radioButton13);
		RadioButton rb14 = (RadioButton)findViewById(R.id.radioButton14);
		
		rb.add(rb1);
		rb.add(rb2);
		rb.add(rb3);
		rb.add(rb4);
		rb.add(rb5);
		rb.add(rb6);
		rb.add(rb7);
		rb.add(rb8);
		rb.add(rb9);
		rb.add(rb10);
		rb.add(rb11);
		rb.add(rb12);
		rb.add(rb13);
		rb.add(rb14);
		
		Button btnOrder = (Button)findViewById(R.id.btnOrder);
		btnOrder.setOnClickListener(new View.OnClickListener() {
		
		String orderItems = "";
			@Override
			public void onClick(View v) {
				
				for(int i=0; i<14;i++){
					if(rb.get(i).isChecked()){
						orderItems += i + ",";
					}
				}
				Log.d(DEBUG_TAG,"String: " + orderItems);
				Intent intent = new Intent(getApplicationContext(),Order.class);
				intent.putExtra("Orders",orderItems);
				startActivity(intent);
				finish();
			}
		});
		
		
		Button accountinfo = (Button)findViewById(R.id.button1);
		accountinfo.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				Intent accountinfointent = new Intent(getApplicationContext(),AccountInfo.class);
				startActivity(accountinfointent);
				
			}
		});
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.drinks_menu, menu);
		return true;
	}

}
